package cn.kimming.wms.web.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.alibaba.fastjson.JSON;
import com.opensymphony.xwork2.ActionContext;

import cn.kimming.wms.domain.JsonMsg;
import cn.kimming.wms.service.IEmployeeService;
import lombok.Getter;
import lombok.Setter;

@Controller("loginAction")
@Scope("prototype")
public class LoginAction extends BaseAction {

	private static final long serialVersionUID = 26674362125140616L;
	
	@Autowired
	private IEmployeeService employeeService;
	
	@Setter
	private String username;
	@Setter
	private String password;
	
	@Override
	public String execute() {
		try {
			employeeService.login(username,password);
		} catch(Exception e) {
			e.printStackTrace();
			ActionContext.getContext().put("msg", e.getMessage());
			return LOGIN;
		}
		return SUCCESS;
	}
}
